package com.emcom.gotour.mvc.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.emcom.gotour.mvc.model.TourCategoryModel;
import com.emcom.gotour.service.TourCategoryService;

@Controller
public class InsertCategoryController {

	@Autowired
	private MessageSource messageSource;

	@Autowired
	private TourCategoryService tourCategoryService;

	@RequestMapping(value={"/admin/insert_category_action.html"})
	public String insertCategoryAction(HttpServletRequest request) {
		tourCategoryService.insert(request.getParameter("name"));
		TourCategoryModel.getView(request, messageSource, tourCategoryService);
		return "/admin/category";
	}

}
